<?php
/**
 * Created by PhpStorm.
 * User: gyq
 * Date: 2018/10/30
 * Time: 20:54
 */

namespace app\api\model;


use think\Db;
use think\Exception;
use think\Model;

class Banner extends Model
{
    protected $hidden=['id','delete_time','update_time'];
    public function items()
    {
        return $this->hasMany('BannerItem', 'banner_id', 'id');
    }

    public static function getBannerById($id)
    {
        return self::with(['items', 'items.img'])->find($id);
    }
}